home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Games #12
/
GEGA012.iso
/
Jogos de Azar
/
fruit.swf
/
scripts
/
C_TablePrizeCLASS.as
< prev
next >
Wrap
Text File
|
2006-01-17
|
5KB
|
215 lines
_global.C_TablePrizeCLASS = function()
{
};
C_TablePrizeCLASS.prototype = new MovieClip();
C_TablePrizeCLASS.prototype.onLoad = function()
{
this.stop();
var b;
var i = 1;
while(i <= this.max)
{
b = this.colimns_mc["c" + i + "_btn"];
b.n = i;
b.onPress = function()
{
this._parent._parent.setCoins(this.n);
this._parent._parent.doOut();
};
b.onRollOver = function()
{
var o = this._parent._parent;
var h = o.hints[this.n];
o.doOver();
if(h != undefined)
{
o.showAlt(h);
}
};
b.onDragOut = b.onRollOut = function()
{
this._parent._parent.doOut();
this._parent._parent.hideAlt();
};
i++;
}
this.setTextColors(this.selecText_color == undefined ? 16777215 : this.selecText_color,this.unselText_color == undefined ? 0 : this.unselText_color,this.topPrizeText_color == undefined ? 14221312 : this.topPrizeText_color);
var f = function(c)
{
var alph;
var o = this.owner;
var white = o.selecText_color;
var black = o.unselText_color;
var top = o.topPrizeText_color;
if(c == "white")
{
if(this.topPrize)
{
c = top;
alph = 100;
}
else
{
c = white;
alph = 80;
}
}
else
{
c = black;
alph = 50;
}
tf = new TextFormat();
tf.color = c;
this.setTextFormat(tf);
this._alpha = alph;
};
var j = 1;
while(j <= this.max)
{
var i = 1;
while(i <= this.numLines)
{
o = this.numbers_mc["row_" + i + "_col_" + j + "_txt"];
o.setTextColor = f;
o.owner = this;
o.topPrize = i == this.numLines && j == this.max;
i++;
}
j++;
}
if(!this._coins)
{
this._coins = 1;
}
this.setCoins(this._coins);
var o = {};
o[1] = "Bet ONE coin";
o[2] = "Bet TWO coins";
o[3] = "Bet TREE coins";
o[4] = "Bet FOUR coins";
o[5] = "Bet FIVE coins";
this.setHints(o);
};
C_TablePrizeCLASS.prototype.setTablePrizes = function(table)
{
if(!table)
{
return undefined;
}
var j = 1;
while(j <= this.max)
{
var i = 1;
while(i <= this.numLines)
{
this.numbers_mc["row_" + i + "_col_" + j + "_txt"].text = table["line_" + i].prize[j - 1];
this.numbersShadow_mc["row_" + i + "_col_" + j + "_txt"].text = table["line_" + i].prize[j - 1];
i++;
}
j++;
}
this.setCoins(this._coins);
};
C_TablePrizeCLASS.prototype.setHints = function(h)
{
this.hints = h;
};
C_TablePrizeCLASS.prototype.setCoins = function(c)
{
if(c < 0 || c > this.max)
{
return false;
}
this.colimns_mc.gotoAndStop("Coins_" + c);
delete this.colimns_mc["c" + this._coins + "_btn"].enabled;
this.colimns_mc["c" + c + "_btn"].enabled = false;
this._coins = c;
var o;
var color;
var j = 1;
while(j <= this.max)
{
cr = j != c ? "black" : "white";
var i = 1;
while(i <= this.numLines)
{
o = this.numbers_mc["row_" + i + "_col_" + j + "_txt"];
o.setTextColor(cr);
i++;
}
j++;
}
this.prizeHolder_mc.removeMovieClip();
this.client.client[this.client.handler](c,this);
};
C_TablePrizeCLASS.prototype.displayPrize = function(r)
{
var j = 1;
while(j <= this.max)
{
var i = 1;
while(i <= this.numLines)
{
o = this.numbers_mc["row_" + i + "_col_" + j + "_txt"];
o.setTextColor("black");
i++;
}
j++;
}
if(!(r instanceof Array))
{
r = [r];
}
var a = [];
var i = 0;
while(i < r.length)
{
a.push(this.numbers_mc["row_" + r[i] + "_col_" + this._coins + "_txt"]);
i++;
}
this.prizeHolder_mc = this.createEmptyMovieClip("holder",123);
this.prizeHolder_mc.onEnterFrame = function()
{
var cr;
var i = 0;
while(i < a.length)
{
this.blink = !this.blink;
cr = !this.blink ? "black" : "white";
a[i].setTextColor(cr);
i++;
}
if(a.length % 2 == 0)
{
this.blink = !this.blink;
}
};
};
C_TablePrizeCLASS.prototype.setTextColors = function(selected, unselected, top)
{
if(top != undefined)
{
this.topPrizeText_color = top;
}
if(selected != undefined)
{
this.selecText_color = selected;
}
if(unselected != undefined)
{
this.unselText_color = unselected;
}
};
C_TablePrizeCLASS.prototype.setChangeHandler = function(client, handler)
{
this.client = {client:client,handler:handler};
};
C_TablePrizeCLASS.prototype.addProperty("coins",function()
{
return this._coins;
}
,C_TablePrizeCLASS.prototype.setCoins);
ASSetPropFlags(_global,"C_TablePrizeCLASS",131);
Object.registerClass("C_TablePrizeCLASS",C_TablePrizeCLASS);